Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow parsing of certificates from Fulcio if ctlog is disabled #288

Merged
merged 4 commits into from
Oct 16, 2024

Conversation

codysoyland
Copy link
Member

Summary

Currently, signing will fail if Fulcio has the ctlog disabled. This patch fixes the parsing of the Fulcio response so it allows certificates without an embedded SCT.

Fixes #287

Release Note

Documentation

@codysoyland codysoyland requested a review from a team as a code owner September 6, 2024 18:44
Signed-off-by: Cody Soyland <[email protected]>
@@ -72,13 +72,18 @@ type publicKey struct {
}

type fulcioResponse struct {
SctCertWithChain signedCertificateEmbeddedSct `json:"signedCertificateEmbeddedSct"`
SignedCertificateEmbeddedSct signedCertificateEmbeddedSct `json:"signedCertificateEmbeddedSct"`
SignedCertificateDetachedSct signedCertificateDetachedSct `json:"signedCertificateDetachedSct"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to deprecate this in fulcio, no other client is using it so far.

Can we avoid adding this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub Artifact Attestations does not use certificate transparency for private CA, using essentially fulcio serve --ct-log-url="", and when configured this way, Fulcio's response includes the certificate in signedCertificateDetachedSct. So this change is currently required to support GitHub's private CA.

Is the deprecation plan in Fulcio to disallow running Fulcio without a CT log?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would parse this as detached SCT is going to be deprecated, which seems fair?

Copy link
Member Author

@codysoyland codysoyland Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I located the Fulcio issue referencing this deprecation, and I noticed a comment from @bdehamer (with my name cc'd no less 😆 ):

One thing to note . . . we're running a private Fulcio instance w/ NO transparency log. In this mode, I noticed that the response from the create-signing-certificate API always uses the signedCertificateDetachedSct field in the response (despite the fact that there is no SCT). As the code is cleaned-up we'll want to make sure not to change this behavior so we don't break existing clients

This is the behavior I'm wanting to preserve/support in this PR -- not add support for detached SCTs in sigstore-go. I'm open to deprecating that JSON key if we want to improve naming the Fulcio response, but for now, this key is required for us to consume Fulcio certs in GitHub's Fulcio deployment.

@haydentherapper, btw, you commented in that issue that the deprecation would preserve that field for this use case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking so long to get back to you - yep, you're right, I was thinking we were writing the certificate in embedded still and that this field was only used when issuing a detached SCT. This LGTM, we'll make breaking changes as part of a 2.0 release that fixes this, but no changes now.

@@ -72,13 +72,18 @@ type publicKey struct {
}

type fulcioResponse struct {
SctCertWithChain signedCertificateEmbeddedSct `json:"signedCertificateEmbeddedSct"`
SignedCertificateEmbeddedSct signedCertificateEmbeddedSct `json:"signedCertificateEmbeddedSct"`
SignedCertificateDetachedSct signedCertificateDetachedSct `json:"signedCertificateDetachedSct"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking so long to get back to you - yep, you're right, I was thinking we were writing the certificate in embedded still and that this field was only used when issuing a detached SCT. This LGTM, we'll make breaking changes as part of a 2.0 release that fixes this, but no changes now.

pkg/sign/certificate_test.go Show resolved Hide resolved
Signed-off-by: Cody Soyland <[email protected]>
@codysoyland codysoyland requested review from haydentherapper and a team October 11, 2024 16:01
Copy link
Member

@steiza steiza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I think it's a good idea to support signing with private deployments where Fulcio might not have a CT log.

@codysoyland codysoyland merged commit 8a157ab into main Oct 16, 2024
11 checks passed
@codysoyland codysoyland deleted the signing-ctlog-disabled branch October 16, 2024 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Signing fails when Fulcio has ctlog disabled
4 participants